package day09API.string;


import java.util.Scanner;

public class demo1 {

    public static void main(String[] args) {
        String s = "abc";
        char[] c = new char[]{'a','b','c','f'};
        String s1 = new String(c);
        System.out.println(s);
        System.out.println(s1);
        System.out.println(s.charAt(1));
        System.out.println(s.codePointAt(1));
        System.out.println(s.compareTo(s1));
        System.out.println(s.concat(s1));
        System.out.println(" >>>>>>>>>>>>>>>>>>>"+String.copyValueOf(c));
        String s2 = String.copyValueOf(c);
        System.out.println(s2);
        System.out.println(s2.equals(s1));
        System.out.println(s1);

        String str = "Hello World";
        int sum = 0;
        for (int i = 0; i < str.length(); i++) {
            char ch = str.charAt(i);
            if (ch>='A'&&ch<='z'){
                sum++;
            }
        }
        System.out.println(sum+"----------------------");

        String s3 = new String("1"+"a");//'new String' is redundant???,为啥只创建了两个对象
        System.out.println(s3);

        String s4 = "Hello 我是你爹";
        String s5 = s4.toUpperCase();
        System.out.println(s5);


        String filename1 = "demo.jPg";
        if (filename1.toLowerCase().endsWith(".jpg")) {
            System.out.println("这是一个jpeg图片");
        }
        if (filename1.endsWith(".jpg")) {
            System.out.println("这是一个jpeg图片");
        }

        String name = " DBX ";
        System.out.println(name);
        System.out.println(name.trim());

//        System.out.println((int) '\n');
        String name1 = " \t \r \n DBX and DQH    ";
        System.out.println(name1.trim());
        System.out.println(name1);

        String s6 = "DBX" + "DQH";

        String str1 = "我是你爸爸，你是我儿。说的好";
        System.out.println(str1.length());
        String s7 = str1.substring(3,5);
        System.out.println(s7);
        System.out.println(str1.substring(7, 9));
        System.out.println(str1.substring(3, 8));

        String id = "50024320010204xxxx";
        String birthday = id.substring(6,6+8);
        System.out.println(birthday);

        System.out.println(id.indexOf("02",3));
        System.out.println(id.indexOf("2001"));
        System.out.println(id.indexOf("2001"));

        System.out.println(id.replaceAll("0", "?"));

        System.out.println('1' + 12 + "adc");


    }
}
